<?php
/**
 * Create by 11li
 * Date 2020/1/16
 * Time 9:22
 *
 */

namespace app\common\service;


use app\common\model\Commission;
use think\Db;

class CommissionService extends Server {
	
	/**
	 * 根据佣金类型统计
	 * @param $userId
	 * @return array|false|\PDOStatement|string|\think\Model
	 */
	public static function getCommissionGroupTypeByUserId($userId) {
		return  Db::name('commission')
			->where(['user_id' => $userId])
			->group('type')
			->column('sum(amount) as amount', 'type');
	}
}